package com.sf.marathon.soul;

import com.sf.marathon.soul.service.ExpressGroupService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

@Configuration
@EnableScheduling
public class SchedulingConfig {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Resource
    private ExpressGroupService groupService;

    @Scheduled(cron = "0 0/1 * * * ?") // 每1分钟执行一次
    public void finishGroups() {
        logger.info("getToken定时任务启动");
        groupService.finishGroup();
    }
}
